package net.pimpas.security.serviceprovider;

import net.pimpas.core.serviceprovider.ServiceProvider;
import net.pimpas.security.serviceprovider.auth.Subject;
import net.pimpas.security.serviceprovider.auth.login.LoginException;
import net.pimpas.security.serviceprovider.auth.login.LoginStatus;
import net.pimpas.security.serviceprovider.auth.login.callback.Callback;
import net.pimpas.security.serviceprovider.auth.login.callback.CallbackHandler;
import net.pimpas.security.serviceprovider.auth.login.callback.CallbackListener;
import net.pimpas.security.serviceprovider.auth.login.callback.name.NameCallback;
import net.pimpas.security.serviceprovider.auth.login.callback.password.PasswordCallback;
import net.pimpas.security.serviceprovider.auth.login.principal.Principal;

public interface SecurityServiceProvider<A extends CallbackHandler, B extends Subject, C extends Callback,
E extends NameCallback, F extends PasswordCallback, G extends Principal> extends ServiceProvider {

	public LoginStatus authenticate( String name, A handler)
		throws LoginException;
	
	public LoginStatus authenticate( String name, A handler, B sub)
		throws LoginException;
	
	public LoginStatus authenticate( String name, CallbackListener listener )
		throws LoginException;
	
	public LoginStatus authenticate( String name, CallbackListener listener, B sub )
		throws LoginException;
	
	public LoginStatus unAuthenticate( String name, A handler)
		throws LoginException;
	
	public LoginStatus unAthenticate( String name, A handler, B sub)
		throws LoginException;
	
	public LoginStatus unAuthenticate( String name, CallbackListener listener )
	throws LoginException;
	
	public LoginStatus unAuthenticate( String name, CallbackListener listener, B sub )
	throws LoginException;

	public E createNameCallback(String prompt, String defaultName);
	public E createNameCallback(String prompt);
	
	public F createPasswordCallback(String prompt, boolean echoOn);
	
	public C createCallback(String name, Object... params);
	
	public A createCallbackHandler(final Runnable action);
	
	public G createPrincipal(String name, Object ob);
}